Okay.
So today we're going to have a look at badges.
And this is kind of the last lecture out of the three about using marketplace service.
Um no no sorry.
Badges doesn't use marketplace service, but they are kind of linked in the same way it is their associated
items to do with your game.
So badges, while you're not going to make any money from them like you would do the previous two.
Um, the other really cool addition to make as a lot of players always like to have badges, um, absolutely
join the game, or when they've played it for a certain amount of time or have reached a certain level,
and also think it can give you a bit of publicity for your game as well, because, um, someone's if
someone clicks on your profile and they see a cool badge that they've got from a game, they you can
receive a badge just for joining a game, then you might want to go and join that just to see for example.
Okay, so the other cool addition, um, so let's have a look at how to code them.
So um, these um I haven't got it.
Would it be on these server?
Yeah.
No.
If we're awarding badges, it would be on the client.
Yes.
So okay, let's add in a local script here then.
Okay.
So badges use a really.
Um.
What's the word?
Um.
I was going to make a joke there, but I forgot the, um.
I couldn't think of the words.
I kind of ruined it.
Okay.
Um.
Game.
Cullen gets service and the service here is called badge service.
So not that too difficult to remember at all.
Okay.
And just like just like with marketplace service, the two lessons we looked on that, um, we're going
to be getting down the badge ID as well.
And this is my badge here.
Okay.
Um, I don't believe badges.
You can, um, you can use other people's badges, like, you can do products.
Um, feel free to try it out.
But but if you're, if you're following this code along and it doesn't work, the first point of call,
um, I would suggest is making your own badge.
And remember, in the lecture of a 1 or 2 back, I did a show.
I did show you how to make, um, both game passes, developer products and also badges into your game.
Okay.
So, um, okay, I can tell by this function that, um, it's going to be it's going to be on the server.
Okay.
Um, let's add a server squadron.
Sorry about that.
Um, I assume because it was to do with the player that, um, it would be on the client, but, um.
Oh, right.
Exit.
Struggling to close the script.
There we go.
Let's put this back in here.
Okay.
I've lost my progress.
Right.
Great.
Not going to the best start.
Badge service is equal to game.
Get service.
Badge service.
Logo badge ID is equal to.
I've now forgotten I now because I didn't place my clipboard.
Let me go get the badge ID really quickly.
There we go.
And paste it in there.
Perfect.
Okay, once you've got this, you then want to use.
Or we can use the Gameplayers dot player added events here to get the player.
So Kinect function player.
And we're going to do this just when they join there's going to be a badge they receive once they've
joined the game.
So to do this we're going to reference a badge service.
We're then going to use the Colon Award badge function.
In here.
We need two arguments to pass over.
We need the players, um, user ID and and the badge ID that's required as well.
So we can get it by just saying player dot user ID like that.
And then get the badge ID by referencing the badge ID there as well.
And that's pretty much it.
Okay.
Not too much at all to do there.
And, um, if we just try this out, I'm not sure if it's gonna work.
If I'm, if I'm ordering it by awarding it to them.
Oh it does.
There we go.
So I wore I won the test badge award.
Great.
I was a bit just uncertain if it would work if we're awarding it straight away just because of things
loading in.
But it did work.
Um, so.
Yeah, not too difficult at all.
It's just this line of code here will allow you to award.
Award the badge.
Um, now, two other bits of information might be useful for you to know about badge servers as well.
Um, is that some other some other functions you have?
Um, badge service code on user has badge async, which will basically check if the player has the badge
already.
So if you don't want to award them the badge twice, or you don't want it to show that the badge has
been awarded twice, twice, even though it hasn't, you probably only use that one there as well.
And you can also get some information about the badge by getting colon get badge info async which fetch
information about the badge given its id.
This could be useful if maybe you want to make a, um, some kind of guy in your game, which shows
all of the badges they have been awarded and which ones they're not yet been awarded, and how they
can receive them.
You would need to get the badge.
Some information about the badge, such as its image, its, um, name, maybe its its rarity as well.
Perhaps you'll probably get all of that, um, just by using this function there.
Okay.
But that is it.
Okay.
Badge service is not a very overly complicated service at all.
But if you're ever wondering how to add badges into your game, you get five badges for free per game,
so absolutely use them if you if, um, there's no harm in not doing so.
And it just gives the extra chance that your game is seen by more people and players.
Just like receiving badges I think as well.
Um, like thanks for playing badge or it gives them, it gives them that additional motivation to keep
playing your game.
It's very important.
You want to give them reasons to keep playing.
And perhaps a badge, something as simple as like playing an hour.
Um, you know, the player they might be playing, playing for, I don't know, 40 minutes and they
might decide, oh, I want that, I want that badge.
So just something like that really.
It just the is it could make the extra few players play your game a bit longer.
So it is absolutely worth doing and it's free for the most part as well.
Okay.
So um, now you know how to how to do those.
Feel free to add those into your own game.
And remember, if you're looking on how to create badges and get their badge IDs, you can find that
in the in the lecture just a couple above.
And we're going to have a look next lesson at messaging service and all about that.
So join me in the next lecture when we have a look at that.